package com.bestv.search.common.service;

import com.bestv.search.common.dataSource.DataSourceKey;
import com.bestv.search.common.model.Info;
import com.bestv.search.common.model.InfoHeaderItem;
import com.bestv.search.common.model.TopNCache;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface InfoManager {

    void delete(DataSourceKey key, Long id);

    List<Info> getInfoByCode(DataSourceKey key, String code);

    List<Info> getInfoByCode(DataSourceKey key, List<String> codes);

    List<Info> getInfoLikeName(DataSourceKey key, String name, int start, int limit);

    int getInfoCountLikeName(DataSourceKey key, String name);

    List<Info> getInfoByName(DataSourceKey key, String[] names);

    List<Info> getInfoByName(DataSourceKey key, String[] names, String p_type);

    Info get(DataSourceKey key, long id);

    String getNetInfoIdByMediaCode(DataSourceKey key, String mediaCode);

    List<Object[]> getComparedInfo(DataSourceKey key, String mediaCode, String p_type);

    List<Info> searchInfoByNames(DataSourceKey key, String[] names, int firstResult, int maxResult);

    int getRowCount(DataSourceKey key, String[] names);

    Set<Info> getInfoSetByIds(DataSourceKey key, Object ids);

    Set<Info> getInfoSetByCodes(DataSourceKey key, Object codes);

    boolean saveOffLineInfoByCode(DataSourceKey key, List<String> code);

    Set<Info> getInfoSetByIds(DataSourceKey key, String ids, Map<String, String> otherConditions) throws ParseException;

    List<String> findPTypes(DataSourceKey key);

    Map<String, Integer[]> findProAndKeyNumInPTypes(DataSourceKey key);

    Map<String, Integer[]> findProAndTagNumInPTypes(DataSourceKey key);

    String[][] findEachKeyAndNumInPType(DataSourceKey key, String ptype, int start, int limit);

    String[][] findEachTagAndNumInPtype(DataSourceKey key, String ptype, int start, int limit);

    int getDistinctCountOfKeysInPtype(DataSourceKey key, String ptype);

    int getDistinctCountOfTagsInPtype(DataSourceKey key, String ptype);

    List<Integer> findCrossKeyword(DataSourceKey key);

    List<String> findCrossKeywordDetail(DataSourceKey key, String ptype1, String ptype2, int start, int limit);

    int fingCrossKeyCount(DataSourceKey key, String ptype1, String ptype2);

    List<Info> getInfosByType(DataSourceKey key, int stat, int lmt, String infoType);

    int getCountByType(DataSourceKey key, String infoType);

    void saveInfoList(DataSourceKey key, List<Info> list);

    void saveUpdateInfoList(DataSourceKey key, List<Info> list);

    void saveUpdateInfo(DataSourceKey key, Info info);

    List<Info> getOverdueSchedule(DataSourceKey key, int validPeiod);

    List<String> getInfoCodesByNameGenreTag(DataSourceKey key, String word);

    List<Info> getOnLineInfos(DataSourceKey key, int start, int limit);

    int getOnLineInfosCount(DataSourceKey key);

    List<Info> getInfosByUpdateTimeForIndex(DataSourceKey key, Date updateIndexTimeForIndex);

    List<TopNCache> getInfosTopNCache(DataSourceKey key, String category, String type);

    Map<String, Integer> getMaxHitCountByTags(DataSourceKey key, String p_type);

    List<Info> getInfoListByIds(DataSourceKey key, List<Long> ids);

    void saveOrUpdateInfoByInfoHeaderItems(DataSourceKey key, List<InfoHeaderItem> items);

    void saveInfoUpFlag(DataSourceKey key, Info info);
}
